<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:61:"/var/www/fish/application/crm/view/ordermanager/addOrder.html";i:1514355082;}*/ ?>
<!DOCTYPE html>
<html>
    
    <head>
        <meta charset="UTF-8">
		<title>小鱼ADMIN</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
		<link rel="stylesheet" href="/public/static/css/font.css">
		<link rel="stylesheet" href="/public/static/css/bgadmin.css">
		<script type="text/javascript" src="/public/static/js/jquery-1.8.0.min.js"></script>
		<script type="text/javascript" src="/public/static/lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="/public/static/js/bgadmin.js"></script>
		<script type="text/javascript" src="/public/static/js/jquery.form.js"></script>  
    </head>
    
    <body>
        <div class="bg-body">
            <form  action="#" method="post" id="mainForm" class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
						<label class="layui-form-label">
							<span class="bg-red">*&nbsp;&nbsp;</span>收货人：
						</label>
						<div class="layui-input-inline">
							<input type="text" readonly="readonly" id="consignee_id" name="consignee" required="" value="<?php echo $customerData['name']; ?>" lay-verify="required"
							autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">
							<span class="bg-red">*&nbsp;&nbsp;</span>下单时间：
						</label>
						<div class="layui-input-inline">
							<input type="text" readonly="readonly" id="createtime_id" name="createtime" required="" lay-verify="required"
							autocomplete="off" class="layui-input">
						</div>
					</div>
					<?php if(($username == 'admin') OR ($priv['display_phone'] == 'Y')): ?>
					<div class="layui-inline">
						<label class="layui-form-label">
							<span class="bg-red">*&nbsp;&nbsp;</span>收货手机：
						</label>
						<div class="layui-input-inline">
							<input type="text" readonly="readonly" id="phone_id" name="phone" required="" value="<?php echo $customerData['phone']; ?>" lay-verify="required"
							autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">
							收货电话：
						</label>
						<div class="layui-input-inline">
							<input type="text" readonly="readonly" id="telephone_id" name="telephone" value="<?php echo $customerData['telephone']; ?>" lay-verify=""
							autocomplete="off" class="layui-input">
						</div>
					</div>
					<?php endif; ?>
			    </div>	
				<div class="layui-form-item layui-form-text">
					<div class="layui-inline">
					<label for="desc" class="layui-form-label">
						<span class="bg-red">*&nbsp;&nbsp;</span>收货地址：
					</label>
					<div class="layui-input-inline">
						<input type="text" name="delivery_address" id="delivery_address_id" required="" lay-verify="required" autocomplete="off" placeholder="请输入收货地址" value="<?php echo $customerData['province']; ?> <?php echo $customerData['city']; ?> <?php echo $customerData['area']; ?> <?php echo $customerData['address_details']; ?>" style="width:520px;" class="layui-input">
					</div>
					<a style="margin-top:5px;" onclick="synchroAddress('<?php echo $customerData['customer_code']; ?>');" class="layui-btn layui-btn-small"><i class="layui-icon">&#x1002;</i> 同步最新地址</a>
					</div>
				</div>
				<input type="hidden" id="province_id" name="province" value="<?php echo $customerData['province']; ?>" />
				<input type="hidden" id="city_id" name="city" value="<?php echo $customerData['city']; ?>" />
				<input type="hidden" id="area_id" name="area" value="<?php echo $customerData['area']; ?>" />
				<input type="hidden" id="import_mark_id" name="import_mark" value="<?php echo $customerData['import_mark']; ?>" />
				<input type="hidden" id="task_id" name="task_id" value="<?php echo $task_id; ?>" />

                <fieldset class="layui-elem-field layui-field-title">
				  <legend>商品信息</legend>
				</fieldset>
				
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">
							销售方案：
						</label>
						<div class="layui-input-inline">
							<input type="text" id="good_name_id" onclick="bg_admin_show('选择方案','./saleProgramList.html',600,400)" autocomplete="off" placeholder="点击选择销售方案" class="layui-input" readonly="readonly" >
						</div>
						<input type="hidden" value="" name="program_id" id="program_id"/>
					</div>
				</div>
				
				<table class="layui-table" lay-data="{id: 'idTest'}" lay-filter="demo">
				  <thead>
					<tr>
						<th lay-data="{checkbox:true, LAY_CHECKED: true}"></th>
						<th lay-data="{field:'id', align:'center', width:60 }">编号</th>
						<th lay-data="{field:'good_name', align:'center', width:160 }">商品名称</th>
						<th lay-data="{field:'good_num', width:100,sort: true}">商品货号</th>
						<th lay-data="{field:'price', width:100,sort: true}">商品价格</th>
						<th lay-data="{field:'cat_name', width:100 }">商品分类</th>
						<th lay-data="{field:'goods_num', width:100 }">商品数量</th>
						<th lay-data="{field:'goods_money', width:100 }">商品总价格</th>
						<th lay-data="{field:'simple_description', width:200}">描述</th>
						<!--<th lay-data="{fixed: 'right', width:100, align:'center', toolbar: '#barDemo'}">操作</th>-->
					</tr>
				  </thead>
				</table>
				 
				<script type="text/html" id="barDemo">
				  <a class="layui-btn layui-btn-mini" lay-event="del">清除商品</a>
				</script>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">
							订单总价：
						</label>
						<div class="layui-input-inline">
							<input type="text" id="goods_amount_id" name="goods_amount" autocomplete="off"  class="layui-input" readonly="readonly" >
						</div>
					</div>
					
					<div class="layui-inline">
						<label class="layui-form-label">是否改价格：</label>
						<div class="layui-input-inline">
							<select name="modify_price" id="modify_price_id" lay-filter="text_type" lay-verify="required">
							  <option value="N">否</option>
							  <option value="Y">是</option>
							</select>
						</div>
					</div>
					
					<div class="layui-inline" id="modify_money_id" style="visibility:hidden;">
						<label class="layui-form-label">
							修改总价：
						</label>
						<div class="layui-input-inline">
							<input type="text"   name="modify_money"
							autocomplete="off" placeholder="请输入修改后的总价" class="layui-input">
						</div>
					</div>
					
				</div>
                <div class="layui-form-item">
					<a class="layui-btn" lay-submit=""  id="save" lay-filter="add">增加</a>
				</div>
            </form>
			<input type="hidden" id="customer_code_id" value="<?php echo $customerData['customer_code']; ?>"/>
        </div>
    </body>
	<script type="text/javascript" src="/public/static/crm/js/orderManager/addOrder.js"></script>
	<script type="text/javascript">
	$(function(){
		$("#createtime_id").val("<?php echo $times; ?>");
	});
	
	function synchroAddress(customer_code){
		$.ajax({
			type : 'post',
			url : '/index.php/crm/Ordermanager/synchroAddress',
			data : 'customer_code='+customer_code,
			dataType : 'json',
			success : function (result) {
				//alert(JSON.stringify(result));
				$("#delivery_address_id").val(result.province+' '+result.city+' '+result.area+' '+result.address_details);
				$("#province_id").val(result.province);
				$("#city_id").val(result.city);
				$("#area_id").val(result.area);
			}
		})
	}
	</script>
</html>